package org.eclipse.gittab.util;

import org.eclipse.gittab.gitTabDsl.GuitarStr;
import org.eclipse.gittab.gitTabDsl.Tuning;
import org.eclipse.xtext.EcoreUtil2;

public class GitTabUtil {

	/**
	 * Simply returns the index of the string in the tuning.
	 * 
	 * @param string
	 * @return
	 */
	public static int guitarString2Int(GuitarStr string) {

		final Tuning tuning = EcoreUtil2.getContainerOfType(string,
				Tuning.class);

		return tuning.getStrings().indexOf(string);
	}

	public static GuitarStr int2GuitarString(int stringInt, Tuning tuning) {

		return tuning.getStrings().get(stringInt);
	}

}
